﻿using UnityEngine;

public static class UtilGeometry
{
    public const int MapHorizonLen = 100;//地图横向长度
    public const int MapVerticalLen = 100;//地图竖向长度
    public static int GetGridIndex(int x, int y)
    {
        return MapHorizonLen * y + x;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="posX">Position Horizon</param>
    /// <param name="posY">Position Vertical</param>
    /// <returns></returns>
    public static Vector3 CreateVector3(float posX, float posY)
    {
        return new Vector3(posX, HexMetrics.DefaultHigh, posY);
    }

    public static void SetHigh(ref Vector3 vec, float high)
    {
        vec.y = high;
    }

    //Get V
    public static float GetPosY(ref Vector3 vec)
    {
        return vec.z;
    }

    public static void SetPosXY(ref Vector3 vec, float posX, float posY)
    {
        vec.x = posX;
        vec.z = posY;
    }

    public static float PosY(this Vector3 vec)
    {
        return vec.z;
    }
}

